home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10516 < prev    next >
Encoding:
Text File  |  1996-08-05  |  857 b   |  38 lines

  1. Path: news.win.tue.nl!!jann
  2. From: jann@ (Jan Cornelis Nieuwenhuizen)
  3. Newsgroups: comp.lang.c++
  4. Subject: nested class forward declaration
  5. Date: 8 Mar 1996 12:44:08 GMT
  6. Organization: Eindhoven University of Technology, The Netherlands
  7. Message-ID: <4hpa2o$55s@svin09.win.tue.nl>
  8. NNTP-Posting-Host: pcnov095.win.tue.nl
  9.  
  10. a new language feature allows forward declaration of a nested class:
  11.  
  12. class Enclose
  13. {
  14.     class Inner; // forward declaration Enclose::Inner
  15.     Inner* use_as_pointer;
  16. };
  17.  
  18. class Enclose::Inner
  19. {
  20.  
  21. };
  22.  
  23. but now i can only use ptr or ref members, and have to (manually) invoke
  24. "new" in all Enclose constructors (and delete in destructors).
  25.  
  26. i-d like to fully declare the Inner class *before* the Enclosing class,
  27. something like:
  28.  
  29. class Enlcose::Inner // need to declare before using as member.
  30. {
  31. };
  32.  
  33. class Enclose
  34. {
  35.     Inner use_as_member;
  36. };
  37.  
  38.